home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d14 / dlchk11.arc / DLCHECK.BAT next >
DOS Batch File  |  1991-04-28  |  7KB  |  235 lines

  1. @echo off
  2. rem  ╔════════════════════════════════════════════╗
  3. rem  ║              DLCHECK.BAT                   ║
  4. rem  ║  Copyright (c) 1990, 1991 by Duane Paulson ║
  5. rem  ║  See DLCHECK.DOC for further information   ║
  6. rem  ╚════════════════════════════════════════════╝
  7.  
  8. for %%a in (dlx dl1 dl2) do set %%a=-1
  9. set dl3=0
  10.  
  11. cd\new_file
  12.  
  13. cls
  14. echo DLCHECK  Version 1.1 Copyright (c) 1990, 1991 by Duane Paulson
  15. echo ══════════════════════════════════════════════════════════════════════════════
  16.  
  17. rem test for executable files
  18.  
  19. for %%a in (EXE COM BIN SYS) do if exist *.%%a set dlx=1
  20.  
  21. rem test executable files
  22.  
  23. if %dlx%==1 scan \new_file
  24. if %dlx%==1 echo ══════════════════════════════════════════════════════════════════════════════
  25.  
  26. if %dlx%==-1 goto noexe
  27.  
  28. rem interpret exit code from SCAN.EXE
  29.  
  30. if errorlevel 0 if not errorlevel 1 set dlx=0
  31. if errorlevel 1 if not errorlevel 2 set dlx=1
  32. if errorlevel 2 set dlx=2
  33.  
  34. :noexe
  35.  
  36. rem test for archived files
  37.  
  38. if exist *.zip set dl1=1
  39. if exist *.arc set dl1=1
  40. if exist *.lzh set dl1=1
  41. if exist *.pak set dl1=1
  42. if exist *.zoo set dl1=1
  43.  
  44. if %dl1%==-1 goto label1
  45. goto next
  46.  
  47. :label1
  48. echo DLCHECK:
  49. echo No Archived Files Found
  50.  
  51. if not %dlx%==-1 goto exemessage
  52. goto end
  53.  
  54. :next
  55.  
  56. rem create first-level subdirectory
  57.  
  58. md \new_file\dl1$$$
  59.  
  60. rem handle first-level archived files
  61.  
  62. cd \new_file\dl1$$$
  63.  
  64. if exist \new_file\*.zip pkunzip \new_file\*.zip
  65. if exist \new_file\*.zip echo ══════════════════════════════════════════════════════════════════════════════
  66.  
  67. if exist \new_file\*.arc pkunpak \new_file\*.arc
  68. if exist \new_file\*.arc echo ══════════════════════════════════════════════════════════════════════════════
  69.  
  70. if exist \new_file\*.lzh lharc e \new_file\*.lzh
  71. if exist \new_file\*.lzh echo ══════════════════════════════════════════════════════════════════════════════
  72.  
  73. if exist \new_file\*.pak copy \new_file\*.pak
  74. if exist \new_file\*.pak pak e *.pak
  75. if exist \new_file\*.pak echo ══════════════════════════════════════════════════════════════════════════════
  76.  
  77. if exist \new_file\*.zoo copy \new_file\*.zoo
  78. if exist \new_file\*.zoo looz x *.zoo
  79. if exist \new_file\*.zoo echo ══════════════════════════════════════════════════════════════════════════════
  80.  
  81. cd \new_file
  82.  
  83. rem scan for viruses
  84.  
  85. scan \new_file\dl1$$$
  86. echo ══════════════════════════════════════════════════════════════════════════════
  87.  
  88. rem interpret exit code from SCAN
  89.  
  90. if errorlevel 0 if not errorlevel 1 set dl1=0
  91. if errorlevel 1 if not errorlevel 2 set dl1=1
  92. if errorlevel 2 set dl1=2
  93.  
  94. rem check for nested archives
  95.  
  96. if exist \new_file\dl1$$$\*.zip set dl2=1
  97. if exist \new_file\dl1$$$\*.arc set dl2=1
  98. if exist \new_file\dl1$$$\*.lzh set dl2=1
  99. if exist \new_file\dl1$$$\*.pak set dl2=1
  100.  
  101. if %dl2%==-1 goto messages
  102.  
  103. rem create subdirectory for testing of nested archives
  104.  
  105. md \new_file\dl1$$$\dl2$$$
  106.  
  107. rem handle nested archives
  108.  
  109. cd \new_file\dl1$$$\dl2$$$
  110.  
  111. if exist \new_file\dl1$$$\*.zip pkunzip \new_file\dl1$$$\*.zip
  112. if exist \new_file\dl1$$$\*.zip echo ══════════════════════════════════════════════════════════════════════════════
  113.  
  114. if exist \new_file\dl1$$$\*.arc pkunpak \new_file\dl1$$$\*.arc
  115. if exist \new_file\dl1$$$\*.arc echo ══════════════════════════════════════════════════════════════════════════════
  116.  
  117. if exist \new_file\dl1$$$\*.lzh lharc e \new_file\dl1$$$\*.lzh
  118. if exist \new_file\dl1$$$\*.lzh echo ══════════════════════════════════════════════════════════════════════════════
  119.  
  120. if exist \new_file\dl1$$$\*.pak copy \new_file\dl1$$$\*.pak
  121. if exist \new_file\dl1$$$\*.pak pak e *.pak
  122. if exist \new_file\dl1$$$\*.pak echo ══════════════════════════════════════════════════════════════════════════════
  123.  
  124. cd \new_file
  125.  
  126. rem test for viruses in nested archives
  127.  
  128. scan \new_file\dl1$$$\dl2$$$ /nomem
  129.  
  130. rem interpret exit code from scan
  131.  
  132. if errorlevel 0 if not errorlevel 1 set dl2=0
  133. if errorlevel 1 if not errorlevel 2 set dl2=1
  134. if errorlevel 2 set dl=2
  135.  
  136. rem test for third-level archives
  137.  
  138. if exist \new_file\dl1$$$\dl2$$$\*.zip set dl3=1
  139. if exist \new_file\dl1$$$\dl2$$$\*.arc set dl3=1
  140. if exist \new_file\dl1$$$\dl2$$$\*.lzh set dl3=1
  141. if exist \new_file\dl1$$$\dl2$$$\*.pak set dl3=1
  142.  
  143. :messages
  144.  
  145. echo ══════════════════════════════════════════════════════════════════════════════
  146. echo DLCHECK:
  147.  
  148. :exemessage
  149.  
  150. rem display message if .exe or .com files were found and scanned in the d/l
  151.  
  152. if %dlx%==0 echo Take Note: Executable files were found in this download.
  153. if %dlx%==0 echo   Further testing may be indicated if these files contain archived material.
  154. if %dlx%==0 echo\
  155. if %dlx%==1 echo Warning!!! SCAN.EXE indicates Virus infection in an unarchived file!!!
  156. if %dlx%==2 echo Warning!!! SCAN.EXE terminated abnormally while checking
  157. if %dlx%==2 echo  an unarchived file! Use Caution!
  158.  
  159. rem display message for result of primary-level scan
  160.  
  161. if %dl1%==0 echo Primary Archives check out OK
  162. if %dl1%==1 echo Warning!!! SCAN.EXE indicates Virus infection in a Primary Archive file!!!!
  163. if %dl1%==2 echo Warning!!! SCAN.EXE terminated abnormally on Primary Level Scan!
  164. if %dl1%==2 echo   Proceed With Caution!!!!
  165.  
  166. rem display message for result of nested-level scan
  167.  
  168. if %dl2%==0 echo Nested Archives check out OK
  169. if %dl2%==1 echo Warning!!! SCAN.EXE indicates Virus infection in a Nested Archive!!!!
  170. if %dl2%==2 echo Warning!!! SCAN.EXE terminated abnormally on Nested Level Scan!
  171. if %dl2%==2 echo   Proceed With Caution!!!!
  172.  
  173. rem display message if third-level file is found
  174.  
  175. if %dl3%==1 echo Take Note: Archives nested to the third level found.
  176. if %dl3%==1 echo   No Scan was performed on 3rd level or greater archive file(s).
  177. if %dl3%==1 echo\
  178.  
  179. rem delete and remove \new_file\dl1$$$\dl2$$$
  180.  
  181. if %dl2%==-1 goto continue
  182. echo Press 'Y' to delete temporary files. Does not affect you original files.
  183. echo on
  184. del \new_file\dl1$$$\dl2$$$\*.*
  185. @echo off
  186. echo Removing temporary subdirectory \new_file\dl1$$$\dl2$$$
  187. rd \new_file\dl1$$$\dl2$$$
  188.  
  189. :continue
  190.  
  191. rem delete and remove \new_file\dl1$$$
  192.  
  193. if %dl1%==-1 goto end
  194. echo Press 'Y' to delete temporary files. Does not affect you original files.
  195. echo on
  196. del \new_file\dl1$$$\*.*
  197. @echo off
  198. echo Removing temporary subdirectory \new_file\dl1$$$
  199. rd \new_file\dl1$$$
  200.  
  201. :end
  202.  
  203. rem check and set errorlevel
  204.  
  205. if %dlx%==-1 goto lbl1
  206. if %dlx%==0 goto lbl1
  207. if %dlx%==1 goto set1
  208. if %dlx%==2 goto lbl3
  209.  
  210. :lbl1
  211. if %dl1%==-1 goto lbl2
  212. if %dl1%==0 goto lbl2
  213. if %dl1%==1 goto set1
  214. if %dl1%==2 goto lbl3
  215.  
  216. :lbl2
  217. if %dl2%==-1 goto enda
  218. if %dl2%==0 goto enda
  219. if %dl2%==1 goto set1
  220. if %dl2%==2 goto lbl3
  221.  
  222. :lbl3
  223. if %dlx%==1 goto set1
  224. if %dl1%==1 goto set1
  225. if %dl2%==1 goto set1
  226. seterr 2
  227. goto enda
  228.  
  229. :set1
  230. seterr 1
  231.  
  232. :enda
  233.  
  234. for %%e in (dlx dl1 dl2 dl3) do set %%e=
  235.